@using Extension
@using k8s.Models
@if (Conditions != null)
{
    @foreach (var ns in Conditions.OrderBy(x => x.Type))
    {
        @if (ns.Type.Contains("Pressure") || ns.Type.Contains("NetworkUnavailable") || ns.Type.Contains("Conflicted"))
        {
            //压力/网络不可达 状态 反过来
            @if (ns.Status == "False")
            {
                <Tag Icon="check" PresetColor=@PresetColor.Green>@ns.Type</Tag>
            }
            else
            {
                <Tooltip Title="@($"{ns.Reason}:{ns.Message}  {ns.LastTransitionTime.AgeFromUtc()} ago (at {ns.LastTransitionTime}).")">
                    <Tag Icon="close" PresetColor=@PresetColor.Red>@ns.Type</Tag>
                </Tooltip>
            }
        }
        else
        {
            @if (ns.Status == "True")
            {
                <Tag Icon="check" PresetColor=@PresetColor.Green>@ns.Type</Tag>
            }
            else
            {
                <Tooltip Title="@($"{ns.Reason}:{ns.Message}  {ns.LastTransitionTime.AgeFromUtc()} ago (at {ns.LastTransitionTime}).")">
                    <Tag Icon="close" PresetColor=@PresetColor.Red>@ns.Type</Tag>
                </Tooltip>
            }
        }
    }
}


@code {

    [Parameter] public IList<V1Condition> Conditions { get; set; }

}
